package com.atguigu.tingshu.order.rpc;

import com.atguigu.tingshu.common.auth.login.annotation.NeedLogin;
import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.order.OrderInfo;
import com.atguigu.tingshu.order.service.OrderInfoService;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author codingyz
 * @Description
 * @date 2025/3/30 16:51
 * @Version 1.0
 */
@RestController
@RequestMapping("/api/inner/orderInfo")
public class OrderInfoRpcController {

    @Autowired
    private OrderInfoService orderInfoService;

    @GetMapping("/getOrderInfoByOrderNo/{orderNo}/{userId}")
    @Operation(summary = "根据订单号查询订单信息")
    Result<OrderInfo> getOrderInfoByOrderNo(@PathVariable String orderNo, @PathVariable Long userId){
        OrderInfo orderInfo = orderInfoService.getOrderInfoAndByUserId(orderNo,userId);
        return Result.ok(orderInfo);
    }
}
